package org.shj.pattern.observer;

public class ConcreteObserver extends Observer{

	private String name;
	private String observerState;
	private Subject subject;
	
	public ConcreteObserver(Subject subject, String name){
		this.subject = subject;
		this.name = name;
	}
	
	public void update(){
		observerState = subject.getSubjectState();
		System.out.println("观察者: " + name + "的新状态是： " + observerState);
	}

	public Subject getSubject() {
		return subject;
	}

	public void setSubject(Subject subject) {
		this.subject = subject;
	}
	
	
}
